home *** CD-ROM | disk | FTP | other *** search
/ Aminet 32 / Aminet 32 (1999)(Schatztruhe)[!][Aug 1999].iso / Aminet / dev / lang / Python151_Src.lha / Python1.5_Source / Amiga / printuserfault.c < prev    next >
C/C++ Source or Header  |  1994-09-30  |  2KB  |  67 lines

  1. RCS_ID_C="$Id: printuserfault.c,v 4.2 1994/09/29 23:09:02 jraja Exp $";
  2. /* 
  3.  *      printuserfault.c - Print a usergroup error message (DOS)
  4.  *
  5.  *      Copyright © 1994 AmiTCP/IP Group, 
  6.  *                       Network Solutions Development Inc.
  7.  *                       All rights reserved.
  8.  */
  9.  
  10. /****** net.lib/PrintUserFault ************************************************
  11.  
  12.     NAME
  13.         PrintUserFault - socket error messages
  14.  
  15.     SYNOPSIS
  16.         PrintUserFault(code, banner)
  17.         void PrintUserFault(LONG, const UBYTE *)
  18.  
  19.     FUNCTION
  20.         The PrintUserFault() function finds the error message corresponding to
  21.         the code and writes it, followed by a newline, to the standard error
  22.         or Output() filehandle. If the argument string is non-NULL it is
  23.         preappended to the message string and separated from it by a colon and
  24.         space (`: '). If string is NULL only the error message string is
  25.         printed.
  26.  
  27.     NOTES
  28.         The PrintUserFault() function used the DOS io functions.  It is
  29.         recommended to use PrintUserFault() when the standard C IO functions
  30.         are not otherwise in use.
  31.  
  32.     SEE ALSO
  33.         strerror(), perror(), <netinclude:sys/errno.h>
  34.  
  35. ******************************************************************************
  36. */
  37.  
  38. #include <errno.h>
  39.  
  40. #include <exec/execbase.h>
  41. extern struct ExecBase *SysBase;
  42.  
  43. #include <dos/dos.h>
  44. #include <dos/dosextens.h>
  45.  
  46. #if __SASC
  47. #include <proto/dos.h>
  48. #include <proto/usergroup.h>
  49. #elif __GNUC__
  50. #include <inline/dos.h>
  51. #endif
  52.  
  53. void PrintUserFault(LONG code, const UBYTE *banner)
  54. {
  55.   struct Process *p = (struct Process *)SysBase->ThisTask;
  56.   BPTR Stderr = p->pr_CES ? p->pr_CES : p->pr_COS;
  57.  
  58.   if (banner != NULL) {
  59.     FPuts(Stderr, (STRPTR)banner);
  60.     FPuts(Stderr, ": ");
  61.   }
  62.   FPuts(Stderr, (STRPTR)ug_StrError(code));
  63.   FPuts(Stderr, "\n");
  64.   Flush(Stderr);
  65. }
  66.  
  67.